home *** CD-ROM | disk | FTP | other *** search
- // ===============================================================
- // Vertex Program:
- // Description:
- // Last Update: 14/08/2003
- // Coder: Andrey Honich
- // ===============================================================
-
- #include "../CGVPMacro.csi"
-
-
- VertAttributes { POSITION_3 TANG_3X3 TEXCOORD0_2 }
-
- MainInput { VIEWPROJ_MATRIX, LIGHT_POS, CAMERA_POS }
- DeclarationsScript
- {
- IN_T0_TANG
- OUT_T0_T1_T2_T3
- }
- PositionScript = PosCommon
- CoreScript
- {
- OUT.Tex0.xy = IN.TexCoord0.xy;
- OUT.Tex3.xy = IN.TexCoord0.xy;
-
- TANG_MATR
-
- // store normalized light vector
- float3 lightVec = normalize(LightPos.xyz - vPos.xyz);
- // transform light vector from object space to tangent space and pass it as a tex coords
- OUT.Tex1.xyz = mul(objToTangentSpace, lightVec.xyz);
-
- // compute view vector
- float3 viewVec = normalize(CameraPos.xyz - vPos.xyz);
-
- // compute half angle vector
- float3 halfAngleVector = normalize(lightVec + viewVec);
-
- // transform half angle vector from object space to tangent space and pass it as a tex coords
- OUT.Tex2.xyz = mul(objToTangentSpace, halfAngleVector);
- }
-